#

| Chapter 3 Logging Out |

## 3.5 Stop Accidental C Shell Logouts

Do you occasionally type CTRL-d by mistake and find out that you're suddenly logged off the system? If you do, you should know about the ignoreeof shell variable or option. CTRL-d is the end-of-file character; when a shell sees it, it thinks that no more input is coming, so it quits. If you're in your login shell (51.9), you're suddenly logged out. If you're not in your login shell, you may still be in trouble: a window may have disappeared, or your environment may have suddenly changed because you dropped from a subshell (38.4) into the parent shell.

If you're a C shell user, you can solve this problem by setting the ignoreeof shell variable:

>     set ignoreeof        # prevent accidental shell termination

(Most users set this in their .cshrc or .login files.) Now typing CTRL-d won't terminate the shell. Instead, you'll get a polite message: `Use` ``logout'` `to` `logout` or perhaps `Use` ``exit'` `to` `leave` `csh`.

In the Korn shell and bash, use `set` `-o` `ignoreeof` instead. If you use the Bourne shell, article 3.6 has a workaround for the problem.

If you're like me, you won't use this feature; I happen to find CTRL-d a convenient shorthand for the logout or exit commands. But my taste is certainly disputable, and even I will admit that my fingers sometimes err.

- ML

3.4 Automatic File Cleanup |  | 3.6 Stop Accidental Bourne Shell Logouts